use serde::Deserialize;
use validator::Validate;

#[derive(Deserialize, Validate, Default)]
#[serde(default)]
pub struct Add {
    #[validate(length(min = 6, max = 255))]
    pub email: String,

    #[validate(length(min = 6))]
    pub password: String,

    #[validate(length(min = 6))]
    pub re_password: String,
}

#[derive(Deserialize, Validate, Default)]
#[serde(default)]
pub struct Edit {
    #[validate(length(min = 20, max = 20))]
    pub id: String,

    #[validate(length(min = 6, max = 255))]
    pub email: String,

    pub password: Option<String>,

    pub re_password: Option<String>,

    pub skip: bool,
}

#[derive(Deserialize, Validate, Default)]
#[serde(default)]
pub struct IDAction {
    #[validate(length(min = 20, max = 20))]
    pub id: String,
}

#[derive(Deserialize, Validate, Default)]
#[serde(default)]
pub struct List {
    #[serde(flatten)]
    pub p: super::Page,
}
